Repository navigation
feat: support the gateway role with send_notification and notification_acknowledged - #33
Merged
Merged
Conversation
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of muster-io/muster#436
Story: S-147
Adds the role
gateway: theGatewayprotocol,Config.rolesandConfig.gateway,sendNotification,BridgeApp.acknowledgefornotification_acknowledged, andanswerEventfor it throughGateway.answer.api/bridge.yamlwas already Muster's current copy (taken in the S-142 pull request), so it is unchanged.Acceptance
master,make spec-checkandmake generate-checkpass, models carryInfo.roles,NotificationInput,NotificationAction,NotificationSent,NotificationAcknowledgedEventmake ci: "api/bridge.yaml is the copy of …/master/api/bridge.yaml", "generated files are current"roles(defaultmessenger),Gatewayprotocol,ConfigErrorfor a role without what it needs, gateway-only without aMessengertest_config.py:test_roles_default_to_messenger_and_info_leaves_them_out,test_info_declares_the_roles,test_a_gateway_only_bridge_runs_without_a_messenger,test_refuses_the_gateway_role_without_a_gateway,test_refuses_the_messenger_role_without_a_messenger,test_refuses_what_a_role_does_not_have,test_refuses_roles,test_refuses_a_gateway_that_is_not_async_or_a_store_without_notificationsaction.dataover 64 bytes, text over 1,000 code points, a bridge without the role:invalidbefore theGatewayis called; the action is kepttest_gateway.py:test_send_notification_is_idempotent,test_send_notification_refuses_what_the_specification_refuses,test_a_bridge_without_the_role_refuses_the_call,test_the_action_is_kept_for_24_hours;test_spec.pyvalidates the call, its problems and the event with openapi-coreacknowledgequeues the event with the notification'sdata, by polling and push; unknown id or no action raisesValueError;answerEventreachesGateway.answertest_events.py:test_acknowledge_queues_notification_acknowledged_with_the_action_data,test_acknowledge_is_pushed,test_acknowledge_of_an_unknown_notification_raises_a_value_error,test_answer_event_reaches_the_gateway,test_answer_event_of_both_roles_goes_to_the_role_of_the_event;test_spec.py::test_pushes_match_the_webhookexamples/gateway_bridge.py, README,make conformancewith--contactmake conformanceon muster-lab againstghcr.io/muster-io/muster@sha256:5aea5471…(muster 0.1.5-SNAPSHOT-42748356): memory-all, memory-thread-messages, memory-interactive and gateway all passed. The gateway run:ROLES gateway,PASS info,PASS poll,PASS answer,PASS notification,WAIT notification_acknowledged … notification_id n1,PASS notification_acknowledgedVerify (
make ci conformance)make ci: lint (ruff, mypy strict, headers), generate-check, spec-check, licenses, 486 tests at 100% coverage, build: all pass.make conformance(Linux, Docker, muster-lab): the four runs above pass.Public API
Gateway,AcknowledgedNotification,NotificationStore,UnknownNotificationError(aValueError),InfoRole,NotificationInput,NotificationAction,NotificationInputLanguage,NotificationSent.Config.rolesandConfig.gateway;BridgeApp(config, messenger=None)(the messenger is optional for a gateway-only bridge);BridgeApp.acknowledge(bot, notification_id, *, update_id, at, chat);EventTypegainsnotification_acknowledged;MemoryStoreimplementsNotificationStore.rolesout ofinfoas before.Changes to the story file
None. Decisions the contract left open: the action data is kept through a separate
NotificationStoreprotocol (a customStorestays valid for a messenger bridge; a gateway whose store lacks it gets aConfigError);Gateway.answerreturnsNoneand the library answersshown_as: notification;AGENTS.mdlayout table gains rows forgateway.pyand the example, whichfiles_toucheddoes not list.Dependencies added
None.
Maintainer
Merge the release pull request that release-please opens (a new
0.xto PyPI); an agent never merges it. The earlier release pull request #32 (0.1.2) is untouched.